﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package {
    import flash.events.*;
    import flash.display.*;
    import flash.utils.*;
    import Classes.*;
    import Classes.util.*;
    import Modules.workers.*;
    import ZLocalization.*;
    import Modules.quest.Managers.*;
    import validation.*;
    import scripting.*;
    import Display.*;
    import flash.text.*;
    import Modules.guide.*;
    import Modules.stats.experiments.*;
    import Classes.announcements.*;
    import Modules.crew.*;
    import Modules.peddler.*;
    import Init.*;
    import Modules.stats.trackers.*;
    import Display.hud.*;
    import Modules.zoo.*;
    import Modules.franchise.*;
    import Modules.flashsale.*;
    import Modules.achievements.*;
    import Modules.freegiftsale.*;

    public class Global {

        public static var DEBUG_MODE_TRACE:Boolean = false;
        public static var stage:Stage = null;
        public static var hud:HUD;
        public static var ui:UI;
        public static var guide:Guide;
        public static var player:Player;
        public static var world:GameWorld;
        public static var gameSettings:GameSettingsInit;
        public static var bootstrap:BootstrapInit;
        public static var freeGiftSaleManager:FreeGiftSaleManager;
        public static var flashSaleManager:FlashSaleManager;
        public static var scriptingManager:ScriptingManager;
        public static var validationManager:ValidationManager;
        public static var announcementManager:AnnouncementManager;
        public static var questManager:GameQuestManager;
        public static var franchiseManager:FranchiseManager;
        public static var peddlerManager:PeddlerGroupManager;
        public static var experimentManager:ExperimentManager;
        public static var xpromoManager:CrossPromoManager;
        public static var achievementsManager:AchievementManager;
        public static var populationMilestoneManager:PopulationMilestoneManager;
        public static var crews:CrewMap;
        public static var factoryWorkerManager:WorkerManager;
        public static var copsNBanditsWorkerManager:WorkerManager;
        public static var trainWorkerManager:WorkerManager;
        public static var zooManager:ZooManager;
        public static var rollCallManager:RollCallManager;
        public static var embeddedArt:EmbeddedArt = new EmbeddedArt();
        public static var delayedAssets:DelayedAssetLoader = new DelayedAssetLoader();
        private static var visiting:String;
        public static var townName:String;
        public static var friendbar:Array;
        public static var postInitActions:ActionQueue = new ActionQueue();
        public static var queryString:Object;
        public static var lastInputTick:int = 0;
        public static var appActive:Boolean = true;
        public static var mission:Object = new Object();
        public static var missionHostFirstName:String = null;
        public static var pendingPresents:int = 0;
        public static var autoPublishEnabled:Boolean = false;
        public static var marketSessionTracker:MarketSessionTracker = new MarketSessionTracker();
        public static var playAnimations = true;
        public static var flashHotParams:Object = new Object();
        public static var disableMenu = false;
        public static var zmcOpenedOnInit:Boolean = false;
        public static var localizer:Localizer;
        public static var isTransitioningWorld:Boolean = false;
        private static var _sandbox_flag:Boolean = false;
        private static var _sandbox_mode:Boolean;

        public static function get isSandbox():Boolean{
            var stackTrace:* = null;
            if (!_sandbox_flag){
                try {
                    throw (new Error());
                } catch(e:Error) {
                    stackTrace = e.getStackTrace();
                    _sandbox_mode = ((!((stackTrace == null))) && (!((stackTrace.indexOf("[") == -1))));
                    _sandbox_flag = true;
                    return (_sandbox_mode);
                };
            };
            return (_sandbox_mode);
        }
        public static function getAssetURL(_arg1:String):String{
            return (GlobalEngine.getAssetUrl(_arg1));
        }
        public static function setVisiting(_arg1:String):void{
            if (((isVisiting()) && (!((Global.visiting == _arg1))))){
                NeighborVisitManager.sendRTNeighborVisitMessage();
            };
            Global.visiting = _arg1;
            if (Global.hud != null){
                Global.hud.setVisiting(isVisiting());
                NeighborVisitManager.resetVisitFlags();
            };
        }
        public static function getVisiting():String{
            return (Global.visiting);
        }
        public static function isVisiting():Boolean{
            return (!((Global.visiting == null)));
        }
        public static function getClassName(_arg1:Object):String{
            var _local2:String = getQualifiedClassName(_arg1);
            var _local3:int = _local2.lastIndexOf(":");
            if (_local3 >= 0){
                _local2 = _local2.substring((_local3 + 1));
            };
            return (_local2);
        }
        public static function _trace(_arg1:String){
            var debug:* = null;
            var info_text:* = null;
            var value:* = _arg1;
            if (Global.DEBUG_MODE_TRACE){
                debug = (Global.stage.getChildByName("flash_debugger") as TextField);
                if (debug == null){
                    info_text = new TextField();
                    info_text.name = "flash_debugger";
                    info_text.y = 55;
                    info_text.height = 250;
                    info_text.width = 200;
                    info_text.border = true;
                    info_text.scrollV = 0;
                    Global.stage.addChild(info_text);
                    debug = (Global.stage.getChildByName("flash_debugger") as TextField);
                    debug.x = 550;
                    Global.stage.addEventListener(FullScreenEvent.FULL_SCREEN, function (_arg1:FullScreenEvent){
                        if (_arg1.fullScreen){
                            debug.x = 1050;
                        } else {
                            debug.x = 550;
                        };
                    });
                };
                debug.scrollV = (debug.scrollV + 1);
                debug.appendText((value + "\n"));
            };
        }
        public static function startTutorial():void{
        }
        public static function getPlayer():Player{
            var _local1:Class = Object(player).constructor;
            return (new _local1((GlobalEngine.socialNetwork) ? GlobalEngine.socialNetwork.getLoggedInUser() : null));
        }

    }
}//package 
